<template>
  <div id="app">
    <router-link v-bind:to="'/user/'+userId">用户</router-link>
    

    <h1>==========================分割线======================</h1>

    
    <router-link to="/home">主页home</router-link>


    <br> <router-link to="/profile"><h3>profile组件</h3></router-link><br>

    <button @click="userClick">用户</button>
    <button @click="profileClick">档案</button>


    <keep-alive>
        <router-view></router-view>
    </keep-alive>
  </div>
</template>

<script>
    export default {
        name: 'App',
        data() {
            return {
                userId: '李民康'
            }
        },
        methods: {
            userClick() {
                this.$router.push('/user/' + this.userId)
            },
            profileClick() {
                this.$router.push({
                    path: '/profile',
                    query: {
                        name: '李民康',
                        age: '19',
                        height: '1.70'
                    }
                })
            }
        }
    }
</script>

<style>

</style>